<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>Insert title here</title>
<link rel="stylesheet" href="//code.jquery.com/ui/1.10.2/themes/smoothness/jquery-ui.css">
<script src="//code.jquery.com/jquery-1.10.2.js"></script>
<script src="//code.jquery.com/ui/1.10.2/jquery-ui.js"></script>
<link rel="stylesheet" href="/resources/demos/style.css">
<style type="text/css">
	.major_header_top{width:750px;margin: auto;margin-top:250px;border: 1px solid lightgray;}
	.intro{width: 750px;height: 120px;}
	.intro_logo{width: 100px;height: 100px;margin:10px;float: left;}
	.intro_simple{width: 630px;height: 120px;float: left;}
	.intro_simple_top{height: 60px;float: left;}
	.intro_simple_majorname{width: 510px;height: 40px;margin-top: 10px;font-weight: bold;font-size: 20px;color: #5D5D5D;float: left;}
	.intro_simple_interest{width: 120px;height: 40px;margin-top: 10px;float: left;}
	#interest a{margin-left:30px;color: #F15F5F;font-weight: 600;font-size: 12px;}
	.intro_simple_bottom{height: 60px;}
	.intro_simple_left{width:210px;height: 60px;float: left;}
	.intro_simple_left_score{width:150px;height: 30px;float: left;}
	.intro_simple_left_text{width:60px;height: 23px;margin-top:7px;color: #5D5D5D;font-weight:bold;float: left;}
	.intro_simple_left_count{width:210px;height: 20px;margin-top:10px;color: #5D5D5D;font-size:13px;float: left;}
	.intro_simple_etc{width:330px;height: 55px;margin-top:5px;margin-left:20px;color: #5D5D5D;font-size:13px;float: left;}
	.intro_simple_more{width:50px;height: 20px;margin-top:40px;margin-left:10px;color: #5D5D5D;font-weight:bold;font-size:13px;float: left;}
	.intro_hidden{width: 750px;}
	.intro_hidden_top{width: 750px;height: 40px;color: #5D5D5D;font-size:13px;}
	.intro_hidden_top_president{width: 130px;height: 25px;margin-top:15px;margin-left:20px;float: left;}
	.intro_hidden_top_establish{width: 130px;height: 25px;margin-top:15px;margin-left:20px;float: left;}
	.intro_hidden_top_domitory{width: 130px;height: 25px;margin-top:15px;margin-left:20px;float: left;}
	.intro_hidden_top_professor{width: 130px;height: 25px;margin-top:15px;margin-left:20px;float: left;}
	.intro_hidden_top_student{width: 130px;height: 25px;margin-top:15px;margin-left:20px;float: left;}
	.intro_hidden_bottom{width: 750px;color: #5D5D5D;font-size:13px;}
	.intro_hidden_bottom_title{width: 750px;height: 25px;margin-top:15px;margin-left:20px;}
	.intro_hidden_bottom_content{border: 1px solid lightgray;border-radius: 2px;background-color:#F6F6F6;width: 710px;margin: auto;margin-bottom: 20px;}
	.major_header_bottom{background-color:#212121;border-left: 1px solid lightgray;border-right: 1px solid lightgray;border-bottom: 1px solid lightgray;width:750px;height:40px;margin: auto;}
</style>
<script type="text/javascript">
	function isInterested(majorunit_no) {
		$.ajax({
			type:"post",
			url:"member.do",
			data:"command=isInterested&&majorunit_no="+majorunit_no,
			
			success:function(data){
				var result=data.result;
				
				if(result==true){
					$('#interest>a').text("즐겨찾기 삭제");
				}else{
					$('#interest>a').text("즐겨찾기 추가");
				}
			}
		});
	}
	
	function interestUnit(majorunit_no) {
		$.ajax({
			type:"post",
			url:"member.do",
			data:"command=interestUnit&&majorunit_no="+majorunit_no,
			
			success:function(data){
				var result=data.result;
				
				if(result==false){
					alert("즐겨찾기가 삭제되었습니다.");
					$('#interest>a').text("즐겨찾기 추가");
				}else{
					alert("즐겨찾기가 추가되었습니다.");
					$('#interest>a').text("즐겨찾기 삭제");
				}
			}
		});
	}
	
	$(function(){
		$('.intro_hidden').hide();
		
		$('#show_more').click(function(){
			if($(this).text()=='더보기'){
				$('.intro_hidden').show();
				$(this).html('닫기');
			}else{
				$('.intro_hidden').hide();
				$(this).html('더보기');
			}
		});
	});
</script>
</head>
<body onload="javascript:isInterested('${param.majorunit_no}')">
<div class="major_header">
	<div class="major_header_top">
		<div class="intro">
			<div class="intro_logo">
				<img alt="logo" src="../img/logo/test.png<%-- ${ mrvo.univ.univ_logo } --%>">
			</div>
			<div class="intro_simple">
				<div class="intro_simple_top">
					<div class="intro_simple_majorname">
						${ mrvo.majorunit_name }[${ mrvo.univ.univtype.univtype_name }]
					</div>
					<div class="intro_simple_interest">
						<span id="interest"><a href="javascript:interestUnit('${param.majorunit_no}')" style="text-decoration: none;"></a></span>
					</div>
				</div>
				<div class="intro_simple_bottom">
					<div class="intro_simple_left">
						<div class="intro_simple_left_score">
							<c:set var="total_scoreAvg" value="${ mrvo.scoreAvg }"/>
							<c:set var="total_scoreAvg_round" value="${ total_scoreAvg+((total_scoreAvg%1>0.5)?(1-(total_scoreAvg%1))%1:-(total_scoreAvg%1)) }"/>
							<c:forEach begin="1" end="${ total_scoreAvg_round }"><img alt="" src="../img/view/review/star_selected.png" width="30px" height="30px"></c:forEach><c:forEach begin="1" end="${ 5-total_scoreAvg_round }"><img alt="" src="../img/view/review/star_deselected.png" width="30px" height="30px"></c:forEach>
						</div>
						<div class="intro_simple_left_text">
							&nbsp;${ mrvo.scoreAvg }점
						</div>
						<div class="intro_simple_left_count">
							리뷰 <font style="color: orange;">${ mrvo.reviewCount }</font>건
						</div>
					</div>
					<div class="intro_simple_etc">
						&nbsp;주소 : ${ mrvo.univ.univ_addr }<br><p>
						&nbsp;홈페이지 : <a href="http://${ mrvo.univ.univ_home }" style="text-decoration: none;">${ mrvo.univ.univ_home }</a>
					</div>
					<div class="intro_simple_more">
						<span id="show_more">더보기</span>
					</div>
				</div>
			</div>
		</div>
		<div class="intro_hidden">
			<hr style="margin-left: 10px; margin-right: 10px; border: 1px solid lightgray;">
			<div class="intro_hidden_top">
				<div class="intro_hidden_top_president">
					총장 : ${ mrvo.univ.univ_president }
				</div>
				<div class="intro_hidden_top_establish">
					설립일 : ${ mrvo.univ.univ_establish } 년
				</div>
				<div class="intro_hidden_top_domitory">
					기숙사 : ${ mrvo.univ.univ_domitory } 명
				</div>
				<div class="intro_hidden_top_professor">
					전임교원 수 : ${ mrvo.univ.univ_professor } 명
				</div>
				<div class="intro_hidden_top_student">
					학생 수 : ${ mrvo.univ.univ_student } 명
				</div>
			</div>
			<div class="intro_hidden_bottom">
				<div class="intro_hidden_bottom_title">
					학교 소개
				</div>
				<div class="intro_hidden_bottom_content">
					${ mrvo.univ.univ_intro }
				</div>
			</div>
		</div>
	</div>
	
	<div class="major_header_bottom">
		<div class="tag_to_review">
			<a href="review.do?command=review&&page=1&&majorunit_no=${param.majorunit_no}" style="text-decoration: none; font-size: 15px; font-weight: bold;">학과리뷰</a>
		</div>
		<div class="tag_to_examinfo">
			<a href="review.do?command=exam&&page=1&&majorunit_no=${param.majorunit_no}" style="text-decoration: none; font-size: 15px; font-weight: bold;">입시리뷰</a>
		</div>
	</div>
</div>
</body>
</html>